<!--
*Author：jxx
 *Contact：283591387@qq.com
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/demo/accident/accident.jsx此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
</template>
<script>
    import extend from "@/extension/demo/accident/accident.jsx";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        setup() {
            const table = ref({
                key: 'AccidentId',
                footer: "Foots",
                cnName: '事故记录',
                name: 'accident/accident',
                url: "/VehicleService/api/accident/",
                sortName: "CreateTime"
            });
            const editFormFields = ref({"AccidentTitle":"","CarLicense":"","IncidentPerson":"","AccidentDate":"","InsureMoney":"","LossMoney":"","AccidentDescribe":"","DirectMoney":"","AccidentRemark":""});
            const editFormOptions = ref([[{"title":"事故标题","field":"AccidentTitle"}],
                              [{"dataKey":"车牌号下拉框","data":[],"title":"车牌号","field":"CarLicense","type":"select"}],
                              [{"title":"事发人","field":"IncidentPerson"}],
                              [{"title":"事故日期","field":"AccidentDate","type":"datetime"}],
                              [{"title":"保险公司赔偿","field":"InsureMoney","type":"decimal"}],
                              [{"title":"公司净损失","field":"LossMoney","type":"decimal"}],
                              [{"title":"事故描述","field":"AccidentDescribe"}],
                              [{"title":"直接经济损失","field":"DirectMoney","type":"decimal"}],
                              [{"title":"备注","field":"AccidentRemark"}]]);
            const searchFormFields = ref({"AccidentTitle":"","CarLicense":"","AccidentDate":""});
            const searchFormOptions = ref([[{"title":"事故标题","field":"AccidentTitle","type":"text"},{"dataKey":"车牌号下拉框","data":[],"title":"车牌号","field":"CarLicense","type":"select"},{"title":"事故日期","field":"AccidentDate","type":"datetime"}]]);
            const columns = ref([{field:'AccidentId',title:'事故记录Id',type:'string',width:120,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'AccidentTitle',title:'事故标题',type:'string',width:120,align:'left',sort:true},
                       {field:'CarLicense',title:'车牌号',type:'string',bind:{ key:'车牌号下拉框',data:[]},width:120,align:'left'},
                       {field:'IncidentPerson',title:'事发人',type:'string',width:120,align:'left'},
                       {field:'AccidentDate',title:'事故日期',type:'date',width:120,align:'left',sort:true},
                       {field:'InsureMoney',title:'保险公司赔偿',type:'decimal',width:120,align:'left'},
                       {field:'LossMoney',title:'公司净损失',type:'decimal',width:120,align:'left'},
                       {field:'AccidentDescribe',title:'事故描述',type:'string',width:120,align:'left'},
                       {field:'DirectMoney',title:'直接经济损失',type:'decimal',width:120,align:'left'},
                       {field:'AccidentRemark',title:'备注',type:'string',width:120,align:'left'},
                       {field:'IsDelete',title:'逻辑删除',type:'int',width:120,hidden:true,align:'left'},
                       {field:'CreateName',title:'创建人',type:'string',width:120,align:'left'},
                       {field:'CreateTime',title:'创建时间',type:'datetime',sort:true,width:120,align:'left',sort:true},
                       {field:'UpdateName',title:'修改人',type:'string',width:120,hidden:true,align:'left'},
                       {field:'UpdateTime',title:'修改时间',type:'datetime',width:120,hidden:true,align:'left',sort:true}]);
            const detail = ref({
                cnName: "#detailCnName",
                table: "#detailTable",
                columns: [],
                sortName: "",
                key: ""
            });
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
            };
        },
    });
</script>
